{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "PBE3/ref/CONTCAR\n",
      "BE3/ref\n",
      "PBE3/ref\n"
     ]
    }
   ],
   "source": [
    "%%bash\n",
    "# Trim a string\n",
    "str=PBE3/ref/CONTCAR \n",
    "echo $str\n",
    "echo ${str:1:7}\n",
    "echo ${str%/CONTCAR}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "here1\n",
      "rr2\n",
      "3\n",
      "4\n",
      "5-bak\n"
     ]
    }
   ],
   "source": [
    "%%bash\n",
    "# For loop\n",
    "for TARGET in {ref.vasp,z2.vasp,3.vasp,4.vasp,5-bak.vasp}\n",
    "do\n",
    "echo ${TARGET%.vasp}.cip\n",
    "done"
   ]
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python [Root]",
   "language": "python",
   "name": "Python [Root]"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
